package com.room2.model;

import java.util.List;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

@Dao
public interface UserDao {

    @Insert
    void insert(User... users);

    @Update
    void update(User... users);

    @Query("delete from t_user where name=:name")
    void delete(String name);//根据名字删除

    @Query("delete from t_user")
    void clear();//清空表

    @Query("select * from t_user")
    LiveData<List<User>> getAllData();//数据绑定到livedata中

}
